﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.models.fountain {
    import flash.utils.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;

    public class TreeModel extends Actor {

        private var _id:String;
        private var _symbol:String;
        private var _state:String;
        private var _readyIn:int;
        private var _readyAt:int;
        private var _timer:int;

        public function get id():String{
            return (this._id);
        }
        public function set id(_arg1:String):void{
            this._id = _arg1;
        }
        public function get symbol():String{
            return (this._symbol);
        }
        public function set symbol(_arg1:String):void{
            this._symbol = _arg1;
        }
        public function get readyAt():int{
            return (this._readyAt);
        }
        public function set readyAt(_arg1:int):void{
            this._readyAt = _arg1;
        }
        public function get readyIn():int{
            return (this._readyIn);
        }
        public function set readyIn(_arg1:int):void{
            this._state = null;
            this._readyIn = _arg1;
        }
        public function startTimer():void{
            clearInterval(this._timer);
            this._timer = setInterval(this.onInterval, 1000);
            this.onInterval();
        }
        public function get state():String{
            return (this._state);
        }
        public function set state(_arg1:String):void{
            this._state = _arg1;
            dispatch(new InfoEvent(EventConstants.SET_TREE_STATE, this.state));
        }
        private function onInterval():void{
            var _local1 = -1;
            if (this._readyIn){
                this._readyIn--;
                _local1 = this._readyIn;
                if (this.state != GameConstants.GROWING){
                    this.state = GameConstants.GROWING;
                };
            } else {
                clearInterval(this._timer);
                this.state = GameConstants.RIPE;
            };
            dispatch(new InfoEvent(EventConstants.UPDATE_TREE_BUBBLE, null, _local1));
        }

    }
}//package net.wooga.pets.models.fountain 
